package org.virbraligo.vboxjavaservice.gui.validator;

import javax.swing.JComponent;
import javax.swing.JTextField;

public class ShutdownActionValidator implements Validator {

	public String validate(JComponent comp) {
		String result = null;
		String action = ((JTextField) comp).getText().trim();
		// #options: poweroff|savestate|acpipowerbutton|acpisleepbutton
		if ("poweroff".equals(action) || "savestate".equals(action)
				|| "acpipowerbutton".equals(action)
				|| "acpisleepbutton".equals(action)) {
			//
		} else {
			result = "Shutdown action only accepts one of: poweroff|savestate|acpipowerbutton|acpisleepbutton";
		}
		return result;
	}

}
